﻿<%@ Page Language="C#" MasterPageFile="~/SimplePMT.Master" AutoEventWireup="true" CodeBehind="ReportProjectStatus.aspx.cs" Inherits="SimplePMT.ReportProjectStatus" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
    <form name="testForm">
    <table>
        <tr>
            <td>From: <%= CalendarInput.Calendar("StartDate", Convert.ToDateTime(StartDate))%>&nbsp;&nbsp;&nbsp;To:<%= CalendarInput.Calendar("EndDate", Convert.ToDateTime(EndDate))%></td>
            <td valign=bottom><%= FormElement.Select(180, "TaskContainerID", 0, projectList, "", true) %>
            &nbsp;&nbsp;<input type="button" value="Get Report" OnClick="reportProject(document.testForm.StartDate.value, document.testForm.EndDate.value, document.testForm.TaskContainerID.options[document.testForm.TaskContainerID.selectedIndex].value);"/>
            </td>
        </tr>
    </table>
    <div id="reportContents">
    <%= onLoadReport%>
    </div>
    </form>
    <script>
        function reportProject(fromDate, toDate, taskContainerId) {
            SimplePMT.ReportProjectStatus.GetStatusReport(fromDate, toDate, taskContainerId, function(response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
                document.getElementById('reportContents').innerHTML = response.value;
            });
            
        }

        var project = true;
        var tmpio;
        var tmpid;
        var sc = document.getElementById('showCompleted');
        
        
        function loadTree(id, io) {
            tmpio = io;
            tmpid = id;
            var el = document.getElementById('container'+ id);
            var tl = document.getElementById('taskList'+ id);
            if (io.src.split('/')[io.src.split('/').length - 1] == 'open.gif') {
                io.src = 'images/closed.gif';
                el.style.display = 'none';
                tl.style.display = 'none';
            } else {
                io.src = 'images/open.gif';
                el.style.display = 'inline';
                tl.style.display = 'inline';
            }
        }
    </script>
</asp:Content>